#include "CEC2017_F3.h"

namespace Solver
{

CEC2017_F3::CEC2017_F3(std::size_t dim):BaseTestFun(dim, FunType_E::CEC2017_F3_E, DifficultyLevel_E::Easy_E, "CEC2017_F3", "")
{
    passY_ = 1e-12;
    bestY_ = 0;
}

CEC2017_F3::~CEC2017_F3()
{

}

value_t CEC2017_F3::calcMinFun(const VectorXd_t &x)
{
    value_t sum1(0), sum2(0), temp;
    for (auto v : x)
    {
        sum1 += v * v;
        sum2 += v;
    }

    sum2 /= 2;
    temp  = sum2 * sum2;
    return sum1 + temp + temp * temp;
}

}